package com.sjc.springbootdemo.service.impl;

import com.sjc.springbootdemo.dao.UserDAO;
import com.sjc.springbootdemo.domain.User;
import com.sjc.springbootdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Classname UserServiceImpl
 * @Description 用户管理模块的service组件实现类
 * @Date 2020/4/23 15:04
 * @Created by SangJiacun
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDAO userDAO;

    @Override
    public List<User> listUsers() {
        return userDAO.listUsers();
    }

    @Override
    public User getUserById(Long userId) {
        return userDAO.getUserById(userId);
    }

    @Override
    public Long saveUser(User user) {
        return userDAO.saveUser(user);
    }

    @Override
    public Integer updateUser(User user) {
        return userDAO.updateUser(user);
    }

    @Override
    public Integer removeUser(Long userId) {
        return userDAO.removeUser(userId);
    }
}
